package com.hdq.mapper;


import com.hdq.annotation.AutoFill;
import com.hdq.enumeration.OperationType;
import entity.Rule;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface RuleMapper {
    @Select("select * from rule")
    List<Rule> getRuleInfo();

//    @Insert("insert into rule (name, description, created_at, updated_at) values (#{name}, #{description}, #{createdAt}, #{updatedAt})")
    @AutoFill(OperationType.INSERT)
    void insert(Rule rule);

//    @Delete("delete from rule where id = #{id}")
    @Delete("delete from rule where id = #{id}")
    void delete(Long id);
//    @Update("update rule set name = #{name}, description = #{description}, updated_at = #{updatedAt} where id = #{id}")
    @AutoFill(OperationType.UPDATE)
    void update(Rule rule);
}
